<?php
	error_reporting(E_ALL || ~E_NOTICE);
	require_once("ReturnBean.php");
	require_once("WeatherBean.php");
	$key = $_REQUEST["key"];
	if(!$key){
		echo json_encode(new ResultBean(501,"参数不全"),JSON_UNESCAPED_UNICODE);
		return;
	}
	$redis = new Redis();
	$redis->connect('47.105.38.70',6379);
	$redis->auth('123456');
	//$redis->set("hello","123455",100); trim去除字符串两边的"号 构造天气数据对象
	$weatherBean = new WeatherBean(trim($redis->get("weatherArea"),'"')
								  ,trim($redis->get("weatherHumidity"),'"')
								  ,trim($redis->get("weatherSunFL"),'"')
								  ,trim($redis->get("weatherSunFX"),'"')
								  ,trim($redis->get("weatherQuality"),'"')
								  ,trim($redis->get("weatherSunSet"),'"')
								  ,trim($redis->get("weatherTemper"),'"')
								  ,trim($redis->get("weatherUpdateTime"),'"')
								  ,trim($redis->get("weatherNotice"),'"')
								  ,trim($redis->get("weatherSunRise"),'"')
								  ,trim($redis->get("weatherInfo"),'"'));
	echo json_encode(new ResultBean(200,"success",$weatherBean),JSON_UNESCAPED_UNICODE);
	//echo $redis->get($key)
	//var_dump($redis->keys("*"));
?>